import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
import viteImagemin from "vite-plugin-imagemin";
import  viteCompression  from 'vite-plugin-compression';
// https://vitejs.dev/config/
export default defineConfig((modeobj:any)=>{
  // console.log('mode===',modeobj);
  const {mode}=modeobj
  
  return{
    plugins: [
      vue(),
      viteImagemin(),
      viteCompression(),
      AutoImport({
        resolvers: [ElementPlusResolver()],
      }),
      Components({
        resolvers: [ElementPlusResolver()],
      }),
    
    ],
    base:mode==='development'?'/':'./',
    build:{
        minify:'terser',
        terserOptions:{
          compress:{
            drop_console:true,
            drop_debugger:true
          }
        },
        sourcemap:false
    }
    
  }
  
});
